﻿<Page x:Class="SportComplex.Program.Pages.View"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:SportComplex.Program.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="590" d:DesignWidth="850"
      Title="View">

    <Grid Background="Gray">

        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="150"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <!--Метка для выбора элемента-->
        <Label Grid.Row="1"
               Content="^^^^^^^^^ Выберите ^^^^^^^^^"
               Foreground="LightGreen"
               FontSize="30"
               HorizontalAlignment="Center"
               VerticalAlignment="Top"/>

        <!--Вернуться в режим подключения-->
        <Button Name="backBtn"
                Content="Назад"
                VerticalAlignment="Center"
                HorizontalAlignment="Left"
                FontSize="20"
                Margin="3"
                Width="80" 
                Click="backBtn_Click"/>
        
        <!--Имя пользователя в Label-->
        <Label Name="NameUserLb"
               Grid.Row="3"
               Foreground="White"
               Content="Имя пользователя"
               FontSize="15"
               HorizontalAlignment="Center"/>

        <!--#region КНОПКИ ПЕРЕХОДА МЕЖДУ ТАБЛИЦАМИ-->
        <WrapPanel Orientation="Horizontal"
                   HorizontalAlignment="Center">
            <Button Name="SwitchOnSectionTableBtn"
                    IsEnabled="False"
                    Content="СЕКЦИИ"
                    FontSize="18"
                    Padding="5"
                    Margin="3"
                    Click="SwitchOnSectionTableBtn_Click"/>
            <Button Name="SwitchOnTrainersTableBtn"
                    IsEnabled="False"
                    Content="ТРЕНЕРЫ"
                    FontSize="18"
                    Padding="5"
                    Margin="3"
                    Click="SwitchOnTrainersTableBtn_Click"/>
            <Button Name="SwitchOnEntryInSectionTableBtn"
                    IsEnabled="False"
                    Content="ЗАПИСЬ В СЕКЦИЮ"
                    FontSize="18"
                    Padding="5"
                    Margin="3"
                    Click="SwitchOnEntryInSectionTableBtn_Click"/>
            <Button Name="SwitchOnClients"
                    IsEnabled="False"
                    Content="КЛИЕНТЫ"
                    FontSize="18"
                    Padding="5"
                    Margin="3"
                    Click="SwitchOnClients_Click"/>
        </WrapPanel>
        <!--#endregion КНОПКИ ПЕРЕХОДА МЕЖДУ ТАБЛИЦАМИ-->

        <!--#region ТАБЛИЦА СЕКЦИИ ####################-->
        <!--Список секций (все пользователи)-->
        <DataGrid Name="dGridSections"
                  Visibility="Hidden"
                  Grid.Row="1"
                  AutoGenerateColumns="False"
                  IsReadOnly="True"
                  SelectionMode="Single">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Секция"
                                    Width="Auto"
                                    Binding="{Binding name}"/>

                <DataGridTextColumn Header="Длительность"
                                    Width="Auto"
                                    Binding="{Binding duration}"/>

                <DataGridTemplateColumn Header="Фото">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Width="80"
                                   Height="80"
                                   VerticalAlignment="Center"
                                   Source="{Binding photo}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTextColumn Header="Стоимость"
                                    Width="Auto"
                                    Binding="{Binding cost}"/>

                <DataGridTextColumn Header="Скидка"
                                    Width="Auto"
                                    Binding="{Binding discount}"/>

                <!--Кнопка редактирования (админ)-->
                <DataGridTemplateColumn Width="Auto"
                                        x:Name="EditorSectionBtn"
                                        Visibility="Hidden">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Name="EditSectionBtn"
                                    FontSize="20"
                                    Width="230"
                                    Height="40"
                                    Content="Редактировать секцию"
                                    Click="EditSectionBtn_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>

        <!--Кнопка добавления секции (админ)-->
        <Button Name="AddSectionBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Width="170"
                Height="40"
                Background="BlueViolet"
                Foreground="White"
                Content="Добавить секцию"
                Margin="20 0 0 0"
                Click="AddSectionBtn_Click"/>

        <!--Кнопка удаления секции (админ)-->
        <Button Name="DeleteSectionBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Background="BlueViolet"
                Foreground="White"
                Width="160"
                Height="40"
                Content="Удалить секцию"
                Margin="0 0 20 0"
                Click="DeleteSectionBtn_Click"/>

        <!--Поиск данных секции (все пользователи)-->
        <StackPanel Name="SearchSectionSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Center"
                    Margin="31 0 0 0">
            <TextBlock Text="Поиск секции"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 7 0"/>
            <TextBox Name="SearchSectionTxb"
                     Height="25"
                     Width="120"
                     TextChanged="SearchSectionTxb_TextChanged"/>
        </StackPanel>

        <!--Фильтрация секций по скидке (все пользователи)-->
        <StackPanel Name="FilterDiscountSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Center"
                    Margin="0 0 1 70">
            <TextBlock Text="Фильтрация по скидке"
                       Foreground="White"
                       VerticalAlignment="Center"
                       Margin="0 0 5 0"/>
            <ComboBox Name="FilterDiscountCmbx"
                      Height="25"
                      Width="120"
                      SelectionChanged="FilterDiscountCmbx_SelectionChanged"/>
        </StackPanel>

        <Label Name="NumRecordsFromSectionDataGrid"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Left"
               Content="Найдено записей (0)"
               Visibility="Hidden"/>
        
        <Label Name="NumAllRecordsFromSectionTable"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Right"
               Content="Записей в таблице из БД (0)"
               Visibility="Hidden"/>
        <!--#endregion ТАБЛИЦА СЕКЦИИ #################-->

        <!--#region ТАБЛИЦА ТРЕНЕРЫ ###################-->
        <!--Список с записями тренеров (тренер, клиент)-->
        <DataGrid Name="dGridTrainers"
                  Visibility="Hidden"
                  Grid.Row="1"
                  AutoGenerateColumns="False"
                  IsReadOnly="True"
                  SelectionMode="Single">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Секция"
                                    Width="Auto"
                                    Binding="{Binding Section.name}"/>
                <DataGridTextColumn Header="Тренер"
                                    Width="Auto"
                                    Binding="{Binding lfname}"/>
            </DataGrid.Columns>
        </DataGrid>

        <!--Список с записями тренеров (админ)-->
        <DataGrid Name="dGridTrainersForAdmin"
                  Visibility="Hidden"
                  Grid.Row="1"
                  AutoGenerateColumns="False"
                  IsReadOnly="True"
                  SelectionMode="Single">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Секция"
                                    Width="Auto"
                                    Binding="{Binding Section.name}"/>
                <DataGridTextColumn Header="Тренер"
                                    Width="Auto"
                                    Binding="{Binding lfname}"/>
                <DataGridTextColumn Header="Логин"
                                    Width="Auto"
                                    Binding="{Binding login}"/>
                <DataGridTextColumn Header="Пароль"
                                    Width="Auto"
                                    Binding="{Binding passwd}"/>

                <!--Кнопка редактирования (админ)-->
                <DataGridTemplateColumn Width="Auto"
                                        x:Name="EditorTrainerBtn"
                                        Visibility="Hidden">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Name="EditTrainerBtn"
                                    FontSize="20"
                                    Width="230"
                                    Height="40"
                                    Content="Редактировать тренера"
                                    Click="EditTrainerBtn_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>

        <!--Кнопка добавления тренера (админ)-->
        <Button Name="AddTrainerBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Width="185"
                Height="40"
                Background="BlueViolet"
                Foreground="White"
                Content="Добавить тренера"
                Margin="20,0,0,0"
                Click="AddTrainerBtn_Click"/>

        <!--Кнопка удаления тренера (админ)-->
        <Button Name="DeleteTrainerBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Background="BlueViolet"
                Foreground="White"
                Width="160"
                Height="40"
                Content="Удалить тренера"
                Margin="0 0 20 0"
                Click="DeleteTrainerBtn_Click"/>

        <!--НЕТУ-->
        <!--Фильтр для выбора секции (клиент, тренер, админ)-->
        <StackPanel Name="FilterTrainersSectionSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="31 0 0 0">
            <TextBlock Text="Выбор секции"
                       VerticalAlignment="Center"
                       Margin="27 0 7 0"
                       Foreground="White"/> 
            <ComboBox Name="FilterTrainersSectionCbx"
                      SelectedItem="{Binding Trainers}"
                      Height="25"
                      Width="147"/>
        </StackPanel>

        <!--Поиск ФИ тренера (клиент, тренер, админ)-->
        <StackPanel Name="SearchTrainerSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="31 35 0 0">
            <TextBlock Text="Поиск тренера"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 7 0"/>
            <TextBox Name="SearchTrainerTxb"
                     Height="25"
                     Width="120"
                     TextChanged="SearchTrainerTxb_TextChanged"/>
        </StackPanel>

        <Label Name="NumRecordsFromTrainersDataGrid"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Left"
               Content="000"
               Visibility="Hidden"/>

        <Label Name="NumAllRecordsFromTrainersTable"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Right"
               Content="000"
               Visibility="Hidden"/>
        <!--#endregion ТАБЛИЦА ТРЕНЕРЫ ###################-->

        <!--#region ТАБЛИЦА ЗАПИСЬ В СЕКЦИЮ ##############-->
        <!--Список с записями тренеров (тренер, админ)-->
        <DataGrid Name="dGridEntryInSection"
                  Visibility="Hidden"
                  Grid.Row="1"
                  AutoGenerateColumns="False"
                  IsReadOnly="True">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Секция"
                                    Width="Auto"
                                    Binding="{Binding Section.name}"/>
                <DataGridTextColumn Header="Клиент"
                                    Width="Auto"
                                    Binding="{Binding Clients.lfname}"/>
                <DataGridTextColumn Header="Тренер"
                                    Width="Auto"
                                    Binding="{Binding Trainers.lfname}"/> 
                <DataGridTextColumn Header="Дата регистрации"
                                    Width="Auto"
                                    Binding="{Binding dateReg}"/>

                <!--Кнопка редактирования (админ)-->
                <DataGridTemplateColumn Width="Auto"
                                        x:Name="EditorEntryInSectionBtn"
                                        Visibility="Hidden">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Name="EditEntyInSectionBtn"
                                    FontSize="20"
                                    Width="230"
                                    Height="40"
                                    Content="Редактировать запись"
                                    Click="EditEntyInSectionBtn_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>

        <!--Кнопка добавления записи (админ)-->
        <Button Name="AddEntryBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Width="185"
                Height="40"
                Background="BlueViolet"
                Foreground="White"
                Content="Добавить запись"
                Margin="20,0,0,0"
                Click="AddEntryBtn_Click"/>

        <!--Кнопка удаления записи (админ)-->
        <Button Name="DeleteEntryBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Background="BlueViolet"
                Foreground="White"
                Width="160"
                Height="40"
                Content="Удалить запись"
                Margin="0 0 20 0"
                Click="DeleteEntryBtn_Click"/>

        <!--НЕТУ-->
        <!--Фильтрация записи по секции (тренер, админ)-->
        <StackPanel Name="FilterEntrySectionSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="31 0 0 0">
            <TextBlock Text="Секция"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 7 0"/>
            <ComboBox x:Name="FilterEntrySectionCbx"
                      Height="25"
                      Width="122"/>
        </StackPanel>

        <!--НЕТУ-->
        <!--Фильтрация записи по клиенту (тренер, админ)-->
        <StackPanel Name="FilterEntryClientSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="31 30 0 0">
            <TextBlock Text="Клиент"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 8 0"/>
            <ComboBox Name="FilterEntryClientCbx"
                      Height="25"
                      Width="147"/>
        </StackPanel>

        <!--НЕТУ-->
        <!--Фильтрация записи по тренеру (тренер, админ)-->
        <StackPanel Name="FilterEntryTrainerSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="31 60 0 0">
            <TextBlock Text="Тренер"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 6 0"/>
            <ComboBox Name="FilterEntryTrainerCbx"
                      Height="25"
                      Width="147"/>
            
        </StackPanel>

        <!--НЕТУ-->
        <!--Фильтрация записи по дате (тренер, админ)-->
        <StackPanel Name="FilterEntryDateSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Top"
                    Margin="31 90 0 0">
            <TextBlock Text="Дата"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="44 0 6 0"/>
            <DatePicker Name="FilterEntryDateDpk"
                        Width="147"/>

        </StackPanel>

        <Label Name="NumRecordsFromEntryDataGrid"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Left"
               Content="000"
               Visibility="Hidden"/>

        <Label Name="NumAllRecordsFromEntryTable"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Right"
               Content="000"
               Visibility="Hidden"/>
        <!--#endregion ТАБЛИЦА ЗАПИСЬ В СЕКЦИЮ ###########-->
        
        <!--#region ТАБЛИЦА КЛИЕНТЫ ######################-->
        <!--Список с записями тренеров (тренер, админ)-->
        <DataGrid Name="dGridClients"
                  Visibility="Hidden"
                  Grid.Row="1"
                  AutoGenerateColumns="False"
                  IsReadOnly="True"
                  SelectionMode="Single">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Клиент"
                                    Width="Auto"
                                    Binding="{Binding lfname}"/>
                <DataGridTextColumn Header="Почта"
                                    Width="Auto"
                                    Binding="{Binding email}"/>
            </DataGrid.Columns>
        </DataGrid>

        <!--Поиск ФИ клиента (тренер, админ)-->
        <StackPanel Name="SearchClientSP"
                    Grid.Row="2"
                    Visibility="Hidden"
                    Width="400"
                    Orientation="Horizontal"
                    VerticalAlignment="Center"
                    Margin="31 0 0 0">
            <TextBlock Text="Поиск клиента"
                       VerticalAlignment="Center"
                       Foreground="White"
                       Margin="30 0 7 0"/>
            <TextBox Name="SearchClientTxb"
                     Height="25"
                     Width="120"
                     TextChanged="SearchClientTxb_TextChanged"/>
        </StackPanel>

        <!--Кнопка удаления клиента (админ)-->
        <Button Name="DeleteClientBtn"
                Grid.Row="2"
                Visibility="Hidden"
                FontSize="20"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Background="BlueViolet"
                Foreground="White"
                Width="160"
                Height="40"
                Content="Удалить клиента"
                Margin="0 0 20 0"
                Click="DeleteClientBtn_Click"/>

        <Label Name="NumRecordsFromClientsDataGrid"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Left"
               Content="000"
               Visibility="Hidden"/>

        <Label Name="NumAllRecordsFromClientsTable"
               Grid.Row="2"
               Background="Black"
               Foreground="White"
               VerticalAlignment="Top"
               HorizontalAlignment="Right"
               Content="000"
               Visibility="Hidden"/>
        <!--#endregion ТАБЛИЦА КЛИЕНТЫ ###################-->
        
    </Grid>

</Page>
